Streams chat Class
Chatroom for people chat in a stream that allows posting messages with type "Streams/chat/message"
Constructor
Streams chat
-
[options]
Parameters:
-
[options]
Object optionalthis object contains function parameters
-
[publisherId]
String optionalRequired if stream option is empty. The publisher's user id.
-
[streamName]
String optionalRequired if stream option is empty. The stream's name.
-
[stream]
Stream optionalOptionally pass a Streams.Stream object here if you have it already
-
[stream]
Stream optionalOptionally pass a Streams.Stream object here if you have it already
-
[inputType="text"]
Stream optionalCan be either "text" or "textarea"
-
[messagesToLoad]
String optionalThe number of "Streams/chat" messages to load at a time.
-
[messageMaxHeight]
String optionalThe maximum height, in pixels, of a rendered message
-
[animations]
String optionalOptions for animations, which can include:
-
[duration=300]
String optionalThe duration of the animation
-
-
[controls={}]
Object optionalControls to show next to each chat message
-
[loadMore]
Object optionalMay be "scroll", "click" or null/false. Defaults to "click".
- "click" will show label with "Click to see earlier messages" (configurable in Q.text.Streams.chat.loadMore.click string), and when the user clicks it, new messages will be loaded.
- "scroll" means new messages will be loaded when the scrollbar of the chat container reaches the top (for desktop) or whole document scrollbar reaches the top (android). On all other browsers it would use pull-to-refresh ... meaning, it will show "Pull to see earlier messages" (html configurable in Q.text.Streams.chat.loadMore.pull string) and as you pull "too far" you trigger the load. As for the indicator of "pulling too far", we will worry about that later, for now skip it. But remember to discuss it with me afterwards.
- null/false/etc. - no interface to load earlier messages
-
[onRefresh]
Q.Event optionalEvent for when an the chat has been updated
-
[onError]
Q.Event optionalEvent for when an error occurs, and the error is passed
-
[onClose]
Q.Event optionalEvent for when chat stream closed
-
Item Index
Methods
prevent
Disables the textarea, preventing the user from writing
a message using the provided interface. They are still able to POST
to the server, however, e.g. manually.
-
message
Parameters:
-
message
String | FalseThe text to display in the placeholder of the textarea while input is prevented. Pass false here to re-enable the textarea.
Returns:
the div that replaces the textarea